package pl.edu.pk.rz.controller;

import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;

import pl.edu.pk.rz.entity.Page;
import pl.edu.pk.rz.service.MenuBoxService;
import pl.edu.pk.rz.service.PageService;
import pl.edu.pk.rz.service.UserService;

public abstract class AbstractController {

	protected Logger logger = Logger.getLogger(this.getClass());
	
	protected static final String MODEL = "model";
	protected static final String COMMAND = "command";
	
	protected static final String VIEW_TEMPLATE = "template";
	protected static final String VIEW_MANAGE_PAGES = "managePages";
	protected static final String VIEW_ADMIN_PANEL = "adminPanel";
	protected static final String VIEW_LOGIN = "login";
	
	protected static final String URL_LOGIN = "/login";
	protected static final String URL_LOGOUT = "/logout";
	
	protected static final String SESSION_PARAM_USER = "user";
	
	@Autowired
	protected PageService pageService;
	
	@Autowired
	protected MenuBoxService menuBoxService;
	
	@Autowired
	protected UserService userService;
	
	protected Map<String, Object> feedPagesList(Map<String, Object> model){
		List<Page> pages = pageService.listAll();
		model.put("pages", pages);
		return model;
	}
}
